<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>后台-角色编辑</title>
	<link rel="stylesheet" href="<%=path%>/css/bootstrap/3.3.5/css/bootstrap.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cropper.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cz.css" />
	<script src="<%=path%>/js/jquery-1.11.0.min.js"></script>
	<script src="<%=path%>/js/plugins/layer/layer.js"></script>
<body class="gray-bg">
<jsp:include page="/views/base/commons/header.jsp"></jsp:include>
<div class="container page-single">
	<div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">角色编辑</h3>
			</div>
			<div class="panel-body event-create">

				<form class="form-horizontal" id="role_form" action="javascript:createRole()">
					<input type="hidden" name="roleId" value="${roleVO.roleId}"/>
					<div class="form-group">
						<label  class="col-sm-1 control-label">
							角色名称<em>*</em>
						</label>
						<div class="col-sm-5">
							<input class="form-control "  
							name="roleName" placeholder="角色名称" type="text" value="${roleVO.roleName}">
						</div>
						<label  class="col-sm-1 control-label">
							角色KEY<em>*</em>
						</label>
						<div class="col-sm-5">
							<input class="form-control "  
							name="roleKey" placeholder="角色名称" type="text" value="${roleVO.roleKey}">
						</div>
					</div>
					<div class="form-group">
						<label  class="col-sm-1 control-label">
							角色说明
						</label>
						<div class="col-sm-5">
							<input class="form-control "  
							name="roleRemark" placeholder="角色说明" type="text" value="${roleVO.roleRemark}">
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-1 col-sm-10">
							<button type="submit" class="btn btn-primary" id="role_confirm_btn">保存</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<jsp:include page="/views/base/commons/footer.jsp"></jsp:include>

<script type="text/javascript">
	function createRole(){
		$("#role_confirm_btn").addClass("disabled").attr("disabled","disabled").val("提交中");
		$.ajax({
			url : path + "/base/role/update",
			type : "post",
			dataType : "json",
			data : $("#role_form").serialize(),
			success : function(data)
			{
				if(data.result){
					layer.msg(data.message,{icon: 1});
					$("#role_confirm_btn").removeClass("disabled").removeAttr("disabled").val("保存");
				}else{
					layer.msg(data.message,{icon: 2});
					$("#role_confirm_btn").removeClass("disabled").removeAttr("disabled").val("保存");
				}
			},error:function(){
				layer.msg("服务器网络繁忙",{icon: 2});
				$("#role_confirm_btn").removeClass("disabled").removeAttr("disabled").val("保存");
			}
		});
	}
	</script>
</body>
</html>